/* standard classes and general style */

:root {
	--text: #222;
	--accent: #ff8080;
	--dark-accent: #22790a88;
	--bg: #fff;
	--sidenav-bg: linear-gradient(#444,#222);
	--top-nav-bg: var(--sidenav-bg);
	--sidenav-fg: #fff;
	--top-nav-fg: #fff;
	--link-fg: #000;
	--code-fg: #111;
	--code-bg: #ffc8c8aa;
	--inline-code-border: solid 1px #9443;
	--hovered-menu-bg: linear-gradient(#444, var(--accent));
}

html, body, div, nav, header {
	margin: 0;
	padding: 0;
}
html {
	scroll-padding-top: 100px;
}
body {
	color: var(--text);
	background: var(--bg);
	font-family: Arial, sans-serif;
	font-size: 17px;
	font-weight: 400;
	line-height: 1.5;
}

nav ul {
	list-style-type: none;
}
nav li {
	list-style: none;
	display: inline-block;
}

kbd {
	padding: 2px 4px;
	color: var(--accent);
	background: var(--sidenav-bg);
	border-radius: 2px;
	box-shadow: none;
	font-weight: bold;
	margin: 1px;
}

kbd.b {
	font-size: 18px;
	padding: 0 5px;
}

/* body background*/

body {
	background-image:
		linear-gradient(to right, rgba(255,255,255,0.95) 0%, rgba(255,255,255,1) 25%, rgba(255,255,255,1) 75%, rgba(255,255,255,0.95) 100%),
		url("../img/cochon.jpg");
	background-position: center;
	background-size: cover;
    background-attachment: fixed;
}
@media (max-width: 800px) {
	body {
		background-image:
			linear-gradient(to right, rgba(255,255,255,0.8) 0%, rgba(255,255,255,1) 10%, rgba(255,255,255,1) 90%, rgba(255,255,255,0.8) 100%),
			url("../img/cochon.jpg");
        background-position: center;
        background-size: cover;
        background-attachment: fixed;
	}
}

/* Common nav */

nav ul, nav li, nav a {
	margin: 0;
	padding: 0;
}
nav a {
	color: var(--sidenav-fg);
	text-decoration: none;
}

/* Top navigation bar */

@media (max-width: 768px) { /* mobile */
	ul.nav-menu {
		background: var(--top-nav-bg);
		color: var(--top-nav-fg);
		width: 100%;
		flex-direction: column;
	}
	nav.site-nav {
		flex-direction: column;
	}
	nav.site-nav > ul.nav-menu {
		position: absolute;
		top: 42px;
		left: 0;
		min-width: 200px;
		opacity: 0;
		visibility: hidden;
		transform: translateY(-10px);
		transition: all 0.3s ease;
		flex-direction: column;
	}
	#nav-toggle {
		display: none; /* hide checkbox */
	}
	.nav-toggle-label {
		padding: 8px 14px;
		border-radius: 5px;
		cursor: pointer;
		display: inline-block;
		user-select: none;
	}
	/* Show menu when hamburger checkbox is checked */
	nav.site-nav #nav-toggle:checked ~ ul.nav-menu {
		opacity: 1;
		visibility: visible;
		transform: translateY(0);
	}
	ul.nav-menu ul.nav-menu .nav-item {
		padding-left: 20px;
	}
}
@media (min-width: 768px) { /* wide screens */
	nav.site-nav > ul.nav-menu {
		flex-direction: row;
	}
	.nav-item .nav-menu { /* revealed on hover */
		display: none;
		position: relative;
	}
	.nav-item .nav-menu {
		display: none;
		position: relative;
	}
	.nav-item:hover .nav-menu {
		position: absolute;
	}
	#nav-toggle, .nav-toggle-label { /* hide hamburger on wide screens */
		display: none;
	}
	nav.site-nav {
		flex-direction: row;
		align-items: center;
	}
	nav.before-menu, nav.after-menu {
		flex-direction: row;
		align-items: center;
	}
}

header {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 100;
	display: flex;
	flex-direction: row;
	align-items: center;
	background: var(--top-nav-bg);
	border-bottom: 1px solid var(--accent);
	padding: 0;
	justify-content: space-between;
	color: var(--top-nav-fg);
}
nav.before-menu, nav.after-menu {
	flex: 1 1 10%;
	display: flex;
}
nav.before-menu {
	justify-content: space-between;
}
nav.after-menu {
	justify-content: flex-end;
}
nav.site-nav {
	flex: 0 0 auto;
	display: flex;
}
ul.nav-menu {
	flex: 0 0 auto;
	display: flex;
}
nav.site-nav > ul.nav-menu {
	align-items: stretch;
}

nav.site-nav a:hover {
	background: var(--hovered-menu-bg);
}
nav.site-nav .selected a, nav.site-nav .nav-item:has(.selected) > a {
	background-image: linear-gradient(#111,#162020);
	color: var(--accent);
}

.nav-item a {
	flex: 0 0 auto;
	padding: 0.8rem 0.5rem;
	display: flex;
}
.nav li {
	flex: 0 0 auto;
	display: flex;
}
.nav-item:has(.nav-menu) > a:after {
	content: " ▼";
	font-size: 0.9rem;
	margin-top: 2px;
	margin-left: 4px;
}
.nav-item:hover .nav-menu {
	display: flex;
	flex-direction: column;
	justify-content: flex-start;
	align-items: stretch;
	background: var(--top-nav-bg);
}
.nav-item:hover .nav-menu .nav-item {
	flex: 0 0 auto;
}
.nav-item .nav-menu .nav-item a {
	padding: 8px 24px 8px 12px;
}
.nav-item .nav-menu .nav-item a:hover {
	background-image: linear-gradient(#111,#162020);
	color: var(--accent);
}

/* article layout */

@media (max-width: 768px) { /* mobile */
	aside.page-nav { /* hide TOC on small screens */
		display: none;
	}
	main {
		margin: 100px 20px 40px 20px;
	}
}
@media (min-width: 768px) { /* wide screens */
	article {
		margin: 80px auto 40px auto;
		max-width: 1000px;
		display: flex;
		flex-direction: row;
	}
	aside.page-nav {
		flex: 0 0 25%;
		max-width: 25%;
		position: relative;
		padding-right: 20px;
	}
	main {
		flex: 0 0 75%;
		max-width: 75%;
	}
}

.before-menu, .after-menu {
	display: flex;
	flex-direction: row;
	align-items: stretch;
}
.nav-link {
	display: flex;
	flex-direction: row;
	align-items: center;
}
.nav-link img {
	max-width: 40px;
	max-height: 40px;
	margin: 0 10px;
}
.nav-link span {
	margin: 0 5px;
}
.nav-link:hover {
	color: var(--accent);
}

.nav-link.bacon-nav-logo img {
	width: 100px;
	max-height: 50px;
	max-width: 100px;
	margin: 0 20px;
}

.external-nav-link {
	opacity: .3;
	transition: opacity .5s;
}
.external-nav-link:hover {
	opacity: 1;
	transition: opacity .5s;
}

/* article's TOC */

nav.page-toc {
	top: 80px;
	position: sticky;
}

nav.page-toc a.toc-title {
	font-weight: bold;
	font-size: 18px;
	margin-left: 20px;
	padding-bottom: 8px;
	align-self: start;
	color: var(--text);
}
nav.page-toc .toc-content {
	background: var(--sidenav-bg);
	padding-top: 10px;
	padding-bottom: 10px;
	border-radius: 5px;
	width: 100%;
	display: flex;
	flex-direction: column;
	align-items: stretch;
}

nav.page-toc .toc-item:hover {
	background: #222;
}
nav.page-toc a {
	display: inline-block;
	width: 100%;
}
nav.page-toc .toc-item:hover a {
	color: var(--accent);
}
nav.page-toc .h1, nav.page-toc .h2 {
	display: flex;
	align-items: stretch;
}
nav.page-toc .h1 {
	padding: 8px 10px 8px 15px;
	font-size: 100%;
}
nav.page-toc .h2 {
	padding: 6px 10px 6px 30px;
	font-size: 90%;
}
nav.page-toc .h3 {
	display: none; /* remove this line to show h3 in TOC */
	padding: 6px 10px 6px 40px;
	font-size: 85%;
}
nav.page-toc .h4 {
	display: none; /* remove this line to show h4 in TOC */
	padding: 6px 10px 6px 50px;
	font-size: 80%;
}

/* article main content */

main img {
	max-width: 100%;
	display: block;
	padding: 0;
	line-height: 1.428571429;
	background-color: #fff;
	border: none;
	border-radius: 0;
	margin: 10px auto 20px auto;
	box-shadow: 2px 2px 5px rgba(0,0,0,0.7);
}

main p.logo img {
	box-shadow: none;
	background: none;
}

main h1 {
	font-size: 22px;
	font-weight: 400;
	border-bottom: solid 1px;
	padding-bottom: 8px;
	margin: 40px 0 25px 0;
	border-image-source: linear-gradient(to right, var(--accent), #888);
	border-image-slice: 1;
	color: #111;
}
main h2 {
	font-size: 20px;
	color: #111;
	margin: 25px 0 20px 0;
}
main h3 {
	font-size: 16px;
	color: #111;
}
main h4 {
	color: #111;
}

pre {
	overflow-x: auto;
}

code {
    padding: 2px 5px;
    background: #fff;
    white-space: pre-wrap;
    word-wrap: break-word;
	border-radius: 0;
	color: var(--code-fg);
	border: var(--inline-code-border);
	background: var(--code-bg);
	font-size: 87%;
}

pre code {
    display: block;
    background: transparent;
    border: none;
    white-space: pre;
    word-wrap: normal;
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
}

kbd {
    padding: 2px 4px;
    font-size: 90%;
    color: #fff;
    background-color: #333;
    border-radius: 3px;
    -webkit-box-shadow: inset 0 -1px 0 rgba(0,0,0,.25);
    box-shadow: inset 0 -1px 0 rgba(0,0,0,.25);
}
pre {
	padding: 0;
	border-radius: 5px;
	color: var(--code-fg);
	background: var(--code-bg);
	border: solid 1px var(--code-bg);
	font-weight: normal;
	padding: 6px 0 4px 6px;
	max-width: 800px;
}

.hljs {
	color: var(--code-fg);
	background: var(--code-bg);
}

p {
	margin-top: 0;
	margin-bottom: 1rem;
}
ol, ul, dl {
	margin-top: 0;
	margin-bottom: 1rem;
}

a code {
    color: #2FA4E7;
}

a:hover code, a:focus code {
    color: #157AB5;
}

main a {
	text-decoration: underline;
	color: var(--link-fg);
}
main a:hover {
	background: var(--accent);
}

table {
	margin: 10px 0 30px 0;
}
th, td {
	padding: 8px 4px;
}
table > thead > tr > th, table > tbody > tr > th, table > tfoot > tr > th, table > thead > tr > td, table > tbody > tr > td, table > tfoot > tr > td {
    border-top: 1px solid var(--dark-accent);
}
table > thead > tr > th {
    border-bottom: 2px solid var(--dark-accent);
}
